
function trim(val)
 { 
	return val.replace(/(\s*$)/g, "");  
}
function subForm(){

		if(document.getElementById('adv_title').value==""){

				alert('请输入广告名称！');

				document.getElementById('adv_title').focus();

				return false;

			}

		if(document.getElementById('key_words').value==""){

				alert('请输入广告关键字！');

				document.getElementById('key_words').focus();

				return false;

			}
			if(document.getElementById('price').value==""){

				alert('请输入价格！');

				document.getElementById('price').focus();

				return false;

			}
				if(document.getElementById('start_date').value==""){

				alert('请输入开始时间！');

				document.getElementById('start_date').focus();

				return false;

			}
				if(document.getElementById('end_date').value==""){

				alert('请输入结束时间！');

				document.getElementById('end_date').focus();

				return false;

			}
			if(document.getElementById('adv_text').value==""){

				alert('请输入广告文本！');

				document.getElementById('adv_text').focus();

				return false;

			}
			   var contact_phone = document.getElementById("contact_info");
		var myreg1=/^[1][\d]{10}$/;
		var myreg2 =/^((0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
		if(contact_phone !=null && contact_phone.value !="")
		{
			if(!myreg1.test(contact_phone.value)&&!myreg2.test(contact_phone.value))
			{
			   alert('请输入有效的联系方式！');
			   document.getElementById("contact_info").focus();
			     document.getElementById("contact_info").value="";
			   return false;
			}
		}
			
			
     document.addForm.submit();

   
}
function Num(){
	
		if(isNaN(document.getElementById('price').value)){

				alert('价格必须是数字！');
				document.getElementById('price').focus();
				document.getElementById('price').value="";
		
				return false;

			}
			if(isNaN(document.getElementById('adv_post').value)){

				alert('广告显示顺序必须是数字！');
				document.getElementById('adv_post').focus();
				document.getElementById('adv_post').value="";
		
				return false;

			}
			
			
	}
	function IsURL(){    
		var email=document.getElementById('adv_url').value;
		myReg = "^((https|http|ftp|rtsp|mms)?://)"+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@
		        + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184
		        + "|" // 允许IP和DOMAIN（域名）
		        + "([0-9a-z_!~*'()-]+\.)*" // 域名- www.
		        + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名
		        + "[a-z]{2,6})" // first level domain- .com or .museum
		        + "(:[0-9]{1,4})?" // 端口- :80
		        + "((/?)|" // a slash isn't required if there is no file name
		        + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
		
		if (!email.match(myReg)){
			alert("链接地址不正确");
 	}
 }

function searchForm(){
	 document.indexForm .submit();
}

  function delOneNews(val){
	 
    if(window.confirm('确认删除吗?'))
    {
   	  window.location.href='/doTradeReg.do?pkid='+val+'&bpm_id=7073'; 
    } 
 
}


 
 